//
//  AddPaymentMethedView.m
//  WalletAPP
//
//  Created by 罗弟祥 on 2019/10/9.
//  Copyright © 2019 罗弟祥. All rights reserved.
//

#import "AddPaymentMethedView.h"
#import "AddPaymentCell.h"
@implementation AddPaymentMethedView

-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.estimatedRowHeight = 2;
    
    self.titleArr = @[@"Bank Transfer", @"Alipay", @"WeChat"/*, @"PayPal", @"Western Union", @"SWIFT international remittance", @"PayNow", @"QIWI", @"Interace e-transfer"*/];
}


- (IBAction)downBtnClick:(UIButton *)sender {
    if (self.cellBlock) {
        self.cellBlock();
    }
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.titleArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.1;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return nil;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return nil;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    AddPaymentCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (!cell) {
        cell = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([AddPaymentCell class]) owner:self options:nil].firstObject;
    }
    cell.titleL.text = self.titleArr[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (self.cellItemBlock) {
        self.cellItemBlock(indexPath);
    }
    
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
